package com.wxy.test2.adapterpattern;

public class test {
    public static void main(String[] args) {
        DataOperation dataOperation = new OperationAdapter(new BinarySearch(),new QuickSort());
        int[] array = {12,43,6,31,9,17,25};
        System.out.print("排序前的数组是:");
        for (int i = 0; i < array.length; i++) {
            if(i != array.length-1){
                System.out.print(array[i]+",");
            }else {
                System.out.println(array[i]);
            }
        }
        dataOperation.sort(array);
        System.out.print("排序后的数组是:");
        for (int i = 0; i < array.length; i++) {
            if(i != array.length-1){
                System.out.print(array[i]+",");
            }else {
                System.out.println(array[i]);
            }
        }
        System.out.println("查找数字25对应的数组下标:" + dataOperation.search(array,25));
    }
}
